//1863. 找出所有子集的异或总和再求和

class Solution {
public:
    int ret;
    int path;
    int subsetXORSum(vector<int>& nums) {
        dfs(nums, 0);
        return ret;
    }
    void dfs(vector<int> &nums, int pos)
    {
        ret += path;
        for(int i = pos; i < nums.size(); i++)
        {
            path = path ^ nums[i];
            dfs(nums, i+1);
            path = path ^ nums[i];
        }
    }
};